package org.nepu.scr.indexrate.converter.compliancerate.differencerate;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.compliancerate.differencerate.UnitA23;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class UnitA23Converter implements AttributeConverter<UnitA23, String> {
    @Override
    public String convertToDatabaseColumn(UnitA23 unitA23) {
        return JSONUtil.toJsonStr(unitA23);
    }

    @Override
    public UnitA23 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, UnitA23.class);
    }
}
